#!/usr/bin/env python

import wx
import sys
import component

class Files(component.ListCtrl):
    '''Files class
    
    @author Julot <andy.julot@gmail.com>
    @since Friday, April 13, 2012. 03:18 PM'''
    
    def __init__(self, parent):
        style = wx.LC_REPORT | wx.LC_SINGLE_SEL
        super(Files, self).__init__(parent, style=style)
        self.InsertColumn(1, "No", wx.LIST_FORMAT_RIGHT)
        self.InsertColumn(2, "Name")
        self.SetColumnWidth(0, 40)
        self.SetColumnWidth(1, wx.LIST_AUTOSIZE)
    
    _values = []
    
    @property
    def values(self):
        return self._values
    
    @values.setter
    def values(self, values):
        self.Freeze()
        self.DeleteAllItems()
        count = 0
        self._values = values
        for value in values:
            no = format(count + 1, ',d')
            index = self.InsertStringItem(sys.maxint, no)
            self.SetStringItem(index, 1, value)
            self.SetItemData(index, count)
            count += 1
        self.Thaw()
    
    